#ifndef COLLAPSEPANEL_H
#define COLLAPSEPANEL_H

#include <QWidget>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QFrame>
#include <QBoxLayout>
#include <QSharedPointer>

class Q_WIDGETS_EXPORT CollapsePanel : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QString title READ getTitle WRITE setTitle)
    Q_PROPERTY(bool checked READ getChecked WRITE setChecked NOTIFY stateChange)
public:
    CollapsePanel(QWidget *parent = 0);
    void init();


    void initSignals();
    void setUserWidget(QWidget*);



public:
    QString getTitle() const;
    void  setTitle(const QString val);
    bool getChecked() const;
    void setChecked(bool checked);


signals:
    void stateChange(bool);
private slots:
    void on_tb_ac_toggled(bool checked);


private:
    QVBoxLayout *verticalLayout;
    QToolButton *tb_ac;
    QSpacerItem *verticalSpacer;

    QSharedPointer<QWidget> userWidget;
};

#endif // COLLAPSEPANEL_H
